﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using IBLL.IBaseInterface;
using IDAL.IBaseInterface;
using AbstractFactory.Factory;

namespace BLL.BaseInterface
{
    public abstract class BaseBLL<D, T> : IBaseBLL<D, T>
        where D : IBaseDAL<T>
        where T : class
    {
        public abstract string DataAccessfullName { get; }

        protected readonly D dal;
        public BaseBLL()
        {
            dal = AbstractFactory<D>.CreateDataAccess(DataAccessfullName);  // 抽象工厂
        }

        //登录，显示，反填
        public List<P> Getlist<P>(params System.Data.SqlClient.SqlParameter[] param)
        {
            return dal.Getlist<P>(param);
        }

        //添加
        public bool ToAddSQL(T t)
        {
            return dal.ToAddSQL(t);
        }

        // 修改
        public bool ToUpdateSQL(T t)
        {
            return dal.ToUpdateSQL(t);
        }

        // 删除
        public bool ToDeleteSQL(T t)
        {
            return dal.ToDeleteSQL(t);
        }
    }
}
